package com.chunuo.aclservice.service.impl;

import com.chunuo.aclservice.entity.Role;
import com.chunuo.aclservice.mapper.RoleMapper;
import com.chunuo.aclservice.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chunuo.aclservice.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author testjava
 * @since 2020-08-05
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Autowired
    private UserRoleService userRoleService;

    /**
     * 用户获取角色
     * @param id
     * @return
     */
    @Override
    public List<Role> selectRoleByUserId(String id) {
        Map userBindRole = userRoleService.getUserBindRole(id);
        List<Role> assignRoles = (List<Role>) userBindRole.get("assignRoles");
        return assignRoles;
    }
}
